package com.guanzi.big_data_mq_process.controller;


import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import com.guanzi.big_data_mq_process.service.IOrdersService;
import com.guanzi.big_data_mq_process.model.dto.OrdersDTO;
import com.guanzi.big_data_mq_process.model.query.OrdersQuery;
import com.guanzi.big_data_mq_process.model.vo.OrdersVO;
import com.guanzi.big_data_mq_process.util.R;
import com.guanzi.big_data_mq_process.util.PageResult;

import java.io.Serializable;
import java.util.List;

/**
 * (Orders)表控制层
 *
 * @author xuguang
 * @since 2025-05-06 21:57:44
 */
@RestController
@RequestMapping("/orders")
public class OrdersController {

    @Autowired
    private IOrdersService ordersService;

    /**
     * 分页列表
     */
    @PostMapping("/getPage")
    public R<PageResult<OrdersVO>> getPage(@RequestBody OrdersQuery query) {
        return R.success(this.ordersService.getPage(query));
    }

    /**
     * 详情
     */
    @GetMapping("/getInfo")
    public R<OrdersVO> getInfo(@RequestParam("id") String id) {
        return R.success(this.ordersService.getInfo(id));
    }

    /**
     * 保存
     */
    @PostMapping("/saveOrders")
    public R<Boolean> saveOrders(@RequestBody OrdersDTO dto) {
        return R.success(this.ordersService.saveOrders(dto));
    }

    /**
     * 删除数据
     */
    @PostMapping("/deleteByIdList")
    public R<Boolean> deleteByIdList(@RequestBody List<String> idList) {
        return R.success(this.ordersService.deleteByIdList(idList));
    }
}

